#pragma once

#include <string>
#include <memory>
#include <chrono>

#include "Base.h"
#include "Status.h"

namespace streamdb {


class Consumer {
public:
    virtual ~Consumer(){}


    virtual Status open() = 0;

    virtual Status subscribe(const std::string & topic, int64_t offset) = 0;

    virtual std::unique_ptr<IIterator<std::string>> all() = 0;

    virtual std::unique_ptr<IIterator<std::string>> poll(std::chrono::milliseconds timeout) = 0;

    virtual void close() = 0;

    virtual const std::string & getDirectory() const  = 0;
};

std::shared_ptr<Consumer> makeConsumer(const std::string & dir) ;

} //end of namespace streamdb
